package parent.cloud.ahri.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

@RestController
public class UserController {

    @Autowired
    public RestTemplate restTemplate;

    @GetMapping("/findOrderById/{id}")
    public String findOrderById(@PathVariable String id) {
        System.out.println(id);
        // 不实用服务ip加端口而是使用服务注册的实例名称
        return restTemplate.getForObject("http://order/findOrderById/" + id, String.class);
    }
}
